<!DOCTYPE HTML>
<html>
<head>
	<title>购物车</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	
	<link href="http://static.hongdayun.com/public/bootstrap/3.3.5/bootstrap.min.css" rel="stylesheet">
	<link href="http://static.hongdayun.com/public/bootstrap/3.3.5/bootstrap.theme.min.css" rel="stylesheet">
	<script src="http://static.hongdayun.com/public/jquery/2.1.4/jquery.min.js"></script>
	<script src="http://static.hongdayun.com/public/bootstrap/3.3.5/bootstrap.min.js"></script>
	<script src="http://static.hongdayun.com/public/simplecartjs/3.0.5/simpleCart.min.js"></script>
	
	<script>
		simpleCart.currency({
			code: "RMB" ,
			name: "Chinese Yuan" ,
			symbol: "￥" ,
			delimiter: "" , 
			decimal: "." , 
			after: false ,
			accuracy: 2
		});
		simpleCart({
			cartColumns: [
				{ view:"image",attr: "img" , label: "" } ,
				{ attr: "name" , label: " " } ,
				{ attr: "price" , label: " ", view: 'currency' } ,
				{ view: "decrement" , label: false , text: "-" } ,
				{  view: "input" ,attr: "quantity" , label: " " } ,
				{ view: "increment" , label: false , text: "+" } ,
				{ attr: "total" , label: " ", view: 'currency' } ,
				//{ view: "remove" , text: "取消" , label: false }
			]
		});
		
		simpleCart({
		checkout: { 
			type: "SendForm" , 
			url: "__APP__/Home/Order/Create/Addon/Mall.html" ,

			method: "POST" , 

			} 
		});
		
		simpleCart.bind( 'beforeCheckout' , function( data ){

			
		   
			data.item_totals = simpleCart.total();
			data.item_grandTotal = simpleCart.grandTotal();
			data.pay_type = $("input[name='pay_type']:checked").val();
			data.express_type = $("input[name='express_type']:checked").val();
			data.address = $("input[name='address']:checked").val();
			data.order_type = 1;
		
			
			
			
		   
		});
		
	</script>
	<style>


		.headerRow{background-color:#F6F6F6;height:20px;padding:25px;}
		.headerRow .item-name{float:left;width:80px;}
		.headerRow .item-price{float:left;width:40px;}
		.headerRow .item-decrement{float:left;width:80px;;}
		.headerRow .item-increment{float:left;margin-right:20px;margin-left:15px;width:5px;}
		.headerRow .item-quantity{float:left;margin-left:35px;width:45px;}
		.headerRow .item-total{float:left;margin-left:50px;margin-right:5px;width:40px;}
		.headerRow .item-remove{float:left;width:30px;}
		.itemRow{clear:both;height:20px;padding:10px;}
		.itemRow .item-img img{float: left;width: 70px;height: 70px;}
		.itemRow .item-name{float: left;width: 100px;margin-left: 34px;}
		.itemRow .item-price{float: left;margin-left: -103px;width: 60px;margin-top: 55px;}
		.itemRow .item-decrement{float:right;margin-right:67px;width:10px;margin-top:56px;}
		.itemRow .simpleCart_decrement{border-radius: 3px;font-size: 12px;line-height:12px;padding: 0px 6px; background-color: #FFFFFF;border:1px solid #CCCCCC;color: #333333;}
		.itemRow .item-increment{float: right;margin-right: -35px;width: 8px;margin-top: 56px;}
		.itemRow .simpleCart_increment{margin-left:25px;border-radius: 3px;font-size: 12px;line-height:12px;padding: 0px 5px; background-color: #FFFFFF;border:1px solid #CCCCCC;color: #333333;}
		.item-quantity .simpleCart_input{margin-left:5px;width:20px; }

		.itemRow .item-quantity{float: right;width: 10px;padding: 0px 8px 0px 8px;margin-top: 52px;margin-right: -29px;}
		.itemRow .item-total{float:right;margin-right:-54px;width:60px;color: #D84A38;font-weight:600;margin-top:3px;}
		.itemRow .item-remove{float:left;margin-left:15px;width:10px;}
		.count{padding-left:30px;margin-top:5px;}
		.count .simpleCart_quantity{margin-left:40px;}
		.ship{padding-left:30px;margin-top:5px;}
		.ship .simpleCart_shipping{margin-left:20px;}
		.grand{padding-left:30px;margin-top:5px;}
		.grand .simpleCart_grandTotal{margin-left:8px;color: #D84A38;font-weight:600;font-family: arial;font-size:14px;}

		</style>
	
</head>
<body>
<nav class="navbar navbar-default">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">默认模板</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">默认模板</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li ><a href="__APP__/Home/Mall/Index/Addon/MallTemplateDefault.html">首页</a></li>
        <li class="active"><a href="__APP__/Home/Mall/Cart/Addon/MallTemplateDefault.html">购物车</a></li>
        <li><a href="javascript:;" class="simpleCart_checkout">提交购物车</a></li>
       
      </ul>
      
      
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>
<div class="container-fluid">
	<div class="row">
		<div class="col-md-offset-2 col-md-8">
			<div class="simpleCart_items"  style="font-size:12px;">
		 
			</div>
			

		</div>
		<div class="col-md-offset-2 col-md-8">
		<br>
		<br>
		<br>
		<label class="radio-inline">
			  <input type="radio" name="pay_type" id="pay_type" value="1"> 微信支付
			</label>
			<label class="radio-inline">
			  <input type="radio" name="pay_type" id="pay_type" value="4"> 货到付款
			</label>
			<label class="radio-inline">
			  <input type="radio" name="pay_type" id="pay_type" value="2"> 储值支付
			</label>
		<br>
		<br>
		<br>
		<label class="radio-inline">
			  <input type="radio" name="express_type" id="express_type" value="0"> 送货上门
			</label>
			<label class="radio-inline">
			  <input type="radio" name="express_type" id="express_type" value="1"> 自提点自提
			</label>
		<br>
		<br>
		<br>
		<label class="radio-inline">
			  <input type="radio" name="address" id="address" value="1"> 信息A
			</label>
			<label class="radio-inline">
			  <input type="radio" name="address" id="address" value="2"> 信息B
			</label>
		</div>
	</div>
</div>
	   <script>
	   
	   

			function cart_{$list.id}(){
				
				var is_buy =  {$list.is_buy};
				
				if(is_buy==1){
				
					var myItem = simpleCart.add({name:'{$list.title}', price: {$list.money},img:'{$list.img}',gid:'{$list.id}',quantity: {$list.is_buy},is_buy: {$list.is_buy}});
					myItem.remove();
					simpleCart.add({name:'{$list.title}', price: {$list.money},img:'{$list.img}',gid:'{$list.id}',quantity: {$list.is_buy},is_buy: {$list.is_buy}});
					
					alert('限购{$list.is_buy}{$list.unit}');
					//var s = myItem.get( "gid" );
					//var ss = myItem.id();
					//var sss = myItem.quantity();
					
					
					
					
				}else{
					simpleCart.add({name:'{$list.title}', price: {$list.money},img:'{$list.img}',gid:'{$list.id}',quantity: 1,is_buy: {$list.is_buy}});
				
				}
				
				

				//window.location.href="__APP__/Mall/Goods/Cart.html"; 
			}
			
			
		
		</script>



        
 

</body>
</html>
